﻿using System;

namespace MySqlQueryToolkit
{
    public interface ITimeQueryReporter
    {
        TimeQueryResult Report(string query);
    }

    public class TimeQueryReporter : ITimeQueryReporter
    {
        private readonly ITimeQueryRepository _timeQueryRepository;

        public TimeQueryReporter(ITimeQueryRepository timeQueryRepository)
        {
            _timeQueryRepository = timeQueryRepository;
        }

        public TimeQueryResult Report(string query)
        {
            if (string.IsNullOrEmpty(query))
            {
                throw new ArgumentException();
            }

            return _timeQueryRepository.GetEntitiesFromDatabase(query);
        }
    }
}
